<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/common/common.jsp"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title></title>
    <link rel="stylesheet" href="./css/layui.css">
  </head>
  
  <body>
   <form class="layui-form" id="form" action="<%= basePath%>/RepairAction_list.action" method="post">
    <blockquote class="layui-elem-quote mylog-info-tit">
        <div class="layui-input-inline">
    		  <input type="text" name="deviceName" placeholder="请输入设备名称" autocomplete="off" class="layui-input" >
 	 	</div>
        <button class="layui-btn" lay-submit name="formDemo">搜索</button>
        <a class="layui-btn layui-btn-danger layui-btn-mini" href="<%=basePath%>RepairAction_openAdd">添加</a>
        <button class="layui-btn" onclick="printpage()"><i class="layui-icon layui-icon-download-circle">导出维修表</i> </button>
    </blockquote>
</form>
<table class="layui-table" lay-even  lay-size="sm" lay-filter="demo">
    <thead>
    <tr>
				<th>编号</th>
				<th>设备名称</th>
				<th>设备编号</th>
				<th>型号</th>
				<th>故障现象描述</th>
				<th>报修时间</th>
				<th>报修人</th>
				<th>操 作</th>
			</tr>
    </thead>
    <tbody>
      <c:forEach var="list" items="${list}">
            <tr>
                <td>${list.id}</td>
                <td>${list.deviceName}</td>
                <td>${list.deviceId}</td>
                <td>${list.modelId}</td>
                <td>${list.content}</td>
                <td>${list.createdTime}</td>
                <td>${list.username}</td>
                <th>
                    <a class="layui-btn layui-btn-mini" href="<%=basePath%>RepairAction_openEdit?id=${list.id}">编辑</a>
                    <a class="layui-btn layui-btn-danger layui-btn-mini" href="<%=basePath%>RepairAction_delete?id=${list.id}">删除</a>
                </th>
            </tr>
  	 </c:forEach>
    </tbody>
</table>
<div id="demo7"></div>

<!-- js控件 -->
<script src="<%=path%>/js/layui.all.js" type="text/javascript"></script>
<script type="text/javascript">
    //Demo
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
        });
        form.render();
 
    });
 
</script>
<script type="text/javascript">
    //    分页组件
    layui.use('laypage', function(){
        var laypage = layui.laypage;
        var deviceName = "${lab.deviceName}";//模糊查询的内容
        var total = "${pageResult.total}";//记录总数
        var page = "${pageResult.page}";//当前页
        var size = "${pageResult.size}";//每页多少
        //完整功能
        laypage.render({
            elem: 'demo7'
            ,count: total
            ,limit: size
            ,curr: page
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
            ,jump: function(obj, first){
                console.log(obj);
                if (!first) { //请求分页的链接
                  window.location.href = "<%=basePath%>/RepairAction_list.action";
                }
            }
        });
 
    });
</script>
<script>
//导出页面
function printpage(){
	window.print();
}
</script>
  </body>
</html>
